//
// Decompiled with: Decompiler.NET, Version=1.3.1.18439, Culture=neutral, PublicKeyToken=null, Version: 1.3.1.18439
// Decompilation Started at: 3/15/2009 10:21:18 PM
// Copyright 2003 - 2004, Jungle Creatures, Inc., All Rights Reserved. 
// Written by Jonathan Pierce, Email: support@junglecreatures.com
//

namespace Utility
{

    #region Namespace Import Declarations

    using System.Collections;
    using System.ComponentModel;
    using System.Data.Common;
    using System.Data.SqlClient;
    using System.Data;
    using System.IO;
    using System;
    using System.Xml;

    #endregion

    public class Database_Com
    {

        #region Fields
        private SqlConnection connection;
        private SqlTransaction transaction;

        private static Database_Com DBCom;
        #endregion

        #region Nested Types

        [System.Serializable()]
        public enum custom
        {
            _DBCom = 0,
        }

        #endregion

        #region Constructors

        static Database_Com()
        {
            Database_Com.DBCom = ((Database_Com)null);
            return;
        }


        public Database_Com()
        {
            return;
        }

        #endregion

        #region Properties

        public static Database_Com _DBCom
        {
            get
            {
                Database_Com theDatabase_Com;
                if (Database_Com.DBCom != null)
                {
                    goto L_0011;
                }
                Database_Com.DBCom = new Database_Com();

            L_0011:
                {
                }
                theDatabase_Com = Database_Com.DBCom;
                goto L_0019;

            L_0019:
                {
                }
                return theDatabase_Com;
            }
        }

        #endregion

        #region Methods

        public SqlConnection CreateConnections(string sqlConnections)
        {
            SqlConnection theSqlConnection;
            this.connection = new SqlConnection(sqlConnections);
            theSqlConnection = this.connection;
            goto L_0015;

        L_0015:
            {
            }
            return theSqlConnection;
        }

        public SqlConnection CreateConnections()
        {
            //string theString;
            XmlDocument theXmlDocument;
            XmlNode theXmlNode;
            XmlElement theXmlElement;
            string theString2;
            Class1 theClass1_;
            SqlConnection theSqlConnection;
           // theString = Environment.GetFolderPath(System.Environment.SpecialFolder.System).ToString();
            //if (File.Exists(string.Concat(theString, "/app.config")))
            //{
            goto L_0024;
            //}
            theSqlConnection = ((SqlConnection)null);
            goto L_0084;

        L_0024:
            {
            }
            //theXmlDocument = new XmlDocument();
            //theXmlDocument.Load(string.Concat(theString, "/app.config"));
            //theXmlElement = theXmlDocument.DocumentElement;
            //theXmlNode = theXmlElement.SelectSingleNode("//*[appSettings]");
            //theString2 = theXmlNode.InnerText.ToString();
            //theClass1_ = new Class1();
            //theString2 = theClass1_.Decrypt(theString2);
            theString2 = System.Configuration.ConfigurationManager.AppSettings["DBConnectionString"];//--edit by thaoht
            this.connection = new SqlConnection(theString2);
            theSqlConnection = this.connection;
            goto L_0084;

        L_0084:
            {
            }
            return theSqlConnection;
        }

        #region Transaction
        /// <summary>
        /// Start transaction edit by Thaoht
        /// </summary>
        public void StartTransaction()
        {
            SqlConnection db = this.connection;
            if (db.State == ConnectionState.Closed)
                db.Open();
            transaction = db.BeginTransaction();
        }

        public void CommitTransaction()
        {
            transaction.Commit();
        }

        public void RollTransaction()
        {
            transaction.Rollback();
        }

        #endregion

        public DataSet Exc_Query(string selectString)
        {
            DataSet theDataSet;
            SqlDataAdapter theSqlDataAdapter;
            Exception theException;
            DataSet theDataSet2;

            try
            {
                theDataSet = new DataSet();
                theSqlDataAdapter = new SqlDataAdapter(selectString, this.connection);
                theSqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                int i = theSqlDataAdapter.Fill(theDataSet);
                theSqlDataAdapter.Dispose();
                this.connection.Close();
                theDataSet2 = theDataSet;
            }
            catch (Exception theException2)
            {
                theException = theException2;
                throw new Exception(theException.Message);
            }
            return theDataSet2;
        }

        public int Excu_NonQuery(string selectString)
        {
            SqlCommand theSqlCommand;
            int i;
            Exception theException;
            int i2;


            try
            {
                this.connection.Open();
                theSqlCommand = new SqlCommand(selectString, this.connection);
                i = theSqlCommand.ExecuteNonQuery();
                theSqlCommand.Dispose();
                this.connection.Close();
                i2 = i;
            }
            catch (Exception theException2)
            {
                theException = theException2;
                throw new Exception(theException.Message);
            }

            return i2;
        }

        public object exec_Stored(SqlConnection con, string storeName, string[] paramNames, SqlDbType[] paramTypes, object[] paramValues)
        {
            int i;
            SqlCommand theSqlCommand;

            int i2;
            SqlParameter theSqlParameter;
            SqlParameter theSqlParameter2;
            Exception theException;
            object theObject;
            i = Math.Min(paramNames.Length, paramTypes.Length);
            i = Math.Min(i, paramValues.Length);


            try
            {
                theSqlCommand = new SqlCommand(storeName, con);
                theSqlCommand.CommandType = CommandType.StoredProcedure;
                i2 = 0;
                goto L_0060;

            L_002B:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], paramTypes[i2]);

            L_004A:
                {
                }

            L_0046:
                {
                }
                theSqlParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
                SqlParameter theSqlParameter3 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_0060:
                {
                }
                if (i2 < i)
                {
                    goto L_002B;
                }
                theSqlParameter2 = new SqlParameter("@check", SqlDbType.VarChar, 20);
                theSqlParameter2.Direction = ParameterDirection.Output;
                SqlParameter theSqlParameter4 = theSqlCommand.Parameters.Add(theSqlParameter2);
                con.Open();
                int i3 = theSqlCommand.ExecuteNonQuery();
                theSqlCommand.Dispose();
                con.Close();
                theObject = theSqlParameter2.Value;
            }
            catch (Exception theException2)
            {
                theException = theException2;
                throw new Exception(theException.Message);
            }


            return theObject;
        }

        public int ExecuteNonQueryWithParam(string sql, string[] paramNames, object[] paramValues)
        {
            int i;
            SqlConnection theSqlConnection;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            int i3;
            Exception theException;
            int i4;
            if (paramNames == null)
            {
                goto L_0006;
            }
            if (paramValues != null)
            {
                goto L_000E;
            }

        L_0006:
            {
            }
            i4 = -1;
            goto L_0093;

        L_000E:
            {
            }
            i = Math.Min(paramNames.Length, paramValues.Length);
            if (i != 0)
            {
                goto L_0022;
            }
            i4 = 0;
            goto L_0093;

        L_0022:
            try
            {
                theSqlConnection = this.connection;
                theSqlConnection.Open();
                theSqlCommand = new SqlCommand(sql, theSqlConnection);
                i2 = 0;
                goto L_0066;

            L_003B:
                {
                }

            L_004D:
                {
                }

            L_004A:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value));
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_0066:
                {
                }
                if (i2 < i)
                {
                    goto L_003B;
                }
                i3 = theSqlCommand.ExecuteNonQuery();
                theSqlCommand.Dispose();
                theSqlConnection.Close();
                i4 = i3;
            }
            catch (Exception theException2)
            {

            L_0084:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_0093:
            {
            }
            return i4;
        }

        public int ExecuteNonQueryWithParam(string sql, string[] paramNames, SqlDbType[] paramTypes, object[] paramValues)
        {
            int i;
            SqlConnection theSqlConnection;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            int i3;
            Exception theException;
            int i4;
            if (paramNames == null)
            {
                goto L_000A;
            }
            if (paramTypes == null)
            {
                goto L_000A;
            }
            if (paramValues != null)
            {
                goto L_0015;
            }

        L_000A:
            {
            }
            throw new Exception("Database: Invalid parameter!");

        L_0015:
            {
            }
            i = Math.Min(paramNames.Length, paramTypes.Length);
            i = Math.Min(i, paramValues.Length);
            if (i != 0)
            {
                goto L_003A;
            }
            throw new Exception("Database: Invalid parameter!");

        L_003A:
            try
            {
                theSqlConnection = this.connection;
                theSqlConnection.Open();
                theSqlCommand = new SqlCommand(sql, theSqlConnection);
                i2 = 0;
                goto L_008A;

            L_0053:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], paramTypes[i2]);

            L_0073:
                {
                }

            L_006F:
                {
                }
                theSqlParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_008A:
                {
                }
                if (i2 < i)
                {
                    goto L_0053;
                }
                i3 = theSqlCommand.ExecuteNonQuery();
                theSqlCommand.Dispose();
                theSqlConnection.Close();
                i4 = i3;
            }
            catch (Exception theException2)
            {

            L_00A8:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_00B7:
            {
            }
            return i4;
        }

        public DataSet ExecuteQueryWithParam(string sql, string[] paramNames, SqlDbType[] paramTypes, object[] paramValues)
        {
            int i;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            SqlDataAdapter theSqlDataAdapter;
            DataSet theDataSet;
            Exception theException;
            DataSet theDataSet2;
            if (paramNames == null)
            {
                goto L_000A;
            }
            if (paramTypes == null)
            {
                goto L_000A;
            }
            if (paramValues != null)
            {
                goto L_0012;
            }

        L_000A:
            {
            }
            theDataSet2 = ((DataSet)null);
            goto L_00D6;

        L_0012:
            {
            }
            i = Math.Min(paramNames.Length, paramTypes.Length);
            i = Math.Min(i, paramValues.Length);
            if (i != 0)
            {
                goto L_0034;
            }
            theDataSet2 = ((DataSet)null);
            goto L_00D6;

        L_0034:
            try
            {
                this.connection.Open();
                theSqlCommand = new SqlCommand(sql, this.connection);
                i2 = 0;
                goto L_0084;

            L_0050:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], paramTypes[i2]);

            L_006E:
                {
                }

            L_006A:
                {
                }
                theSqlParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_0084:
                {
                }
                if (i2 < i)
                {
                    goto L_0050;
                }
                theSqlDataAdapter = new SqlDataAdapter(theSqlCommand);
                theSqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                theDataSet = new DataSet();
                int i3 = theSqlDataAdapter.Fill(theDataSet);
                theSqlDataAdapter.Dispose();
                theSqlCommand.Dispose();
                this.connection.Close();
                theDataSet2 = theDataSet;
            }
            catch (Exception theException2)
            {

            L_00C7:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_00D6:
            {
            }
            return theDataSet2;
        }

        public DataSet ExecuteQueryWithParam(string sql, string[] paramNames, object[] paramValues)
        {
            int i;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            SqlDataAdapter theSqlDataAdapter;
            DataSet theDataSet;
            Exception theException;
            DataSet theDataSet2;
            if (paramNames == null)
            {
                goto L_0006;
            }
            if (paramValues != null)
            {
                goto L_000E;
            }

        L_0006:
            {
            }
            theDataSet2 = ((DataSet)null);
            goto L_00BC;

        L_000E:
            {
            }
            i = Math.Min(paramNames.Length, paramValues.Length);
            if (i != 0)
            {
                goto L_0025;
            }
            theDataSet2 = ((DataSet)null);
            goto L_00BC;

        L_0025:
            try
            {
                this.connection.Open();
                theSqlCommand = new SqlCommand(sql, this.connection);
                i2 = 0;
                goto L_006A;

            L_0041:
                {
                }

            L_0053:
                {
                }

            L_0050:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value));
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_006A:
                {
                }
                if (i2 < i)
                {
                    goto L_0041;
                }
                theSqlDataAdapter = new SqlDataAdapter(theSqlCommand);
                theSqlDataAdapter.MissingSchemaAction = MissingSchemaAction.AddWithKey;
                theDataSet = new DataSet();
                int i3 = theSqlDataAdapter.Fill(theDataSet);
                theSqlDataAdapter.Dispose();
                theSqlCommand.Dispose();
                this.connection.Close();
                theDataSet2 = theDataSet;
            }
            catch (Exception theException2)
            {

            L_00AD:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_00BC:
            {
            }
            return theDataSet2;
        }

        public object ExecuteScalar(string sqlSelect)
        {
            SqlCommand theSqlCommand;
            object theObject;
            Exception theException;
            object theObject2;

        L_0000:
            try
            {
                this.connection.Open();
                theSqlCommand = new SqlCommand(sqlSelect, this.connection);
                theObject = theSqlCommand.ExecuteScalar();
                theSqlCommand.Dispose();
                this.connection.Close();
                theObject2 = theObject;
            }
            catch (Exception theException2)
            {

            L_0034:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_0041:
            {
            }
            return theObject2;
        }

        public object ExecuteScalarWithParam(string sql, string[] paramNames, object[] paramValues)
        {
            int i;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            object theObject;
            Exception theException;
            object theObject2;
            if (paramNames == null)
            {
                goto L_0006;
            }
            if (paramValues != null)
            {
                goto L_0013;
            }

        L_0006:
            {
            }
            theObject2 = false;
            goto L_00A3;

        L_0013:
            {
            }
            i = Math.Min(paramNames.Length, paramValues.Length);
            if (i != 0)
            {
                goto L_002C;
            }
            theObject2 = false;
            goto L_00A3;

        L_002C:
            try
            {
                this.connection.Open();
                theSqlCommand = new SqlCommand(sql, this.connection);
                i2 = 0;
                goto L_0071;

            L_0048:
                {
                }

            L_005A:
                {
                }

            L_0057:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value));
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_0071:
                {
                }
                if (i2 < i)
                {
                    goto L_0048;
                }
                theObject = theSqlCommand.ExecuteScalar();
                theSqlCommand.Dispose();
                this.connection.Close();
                theObject2 = theObject;
            }
            catch (Exception theException2)
            {

            L_0094:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_00A3:
            {
            }
            return theObject2;
        }

        public object ExecuteScalarWithParam(string sql, string[] paramNames, SqlDbType[] paramTypes, object[] paramValues)
        {
            int i;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            object theObject;
            Exception theException;
            object theObject2;
            if (paramNames == null)
            {
                goto L_000A;
            }
            if (paramTypes == null)
            {
                goto L_000A;
            }
            if (paramValues != null)
            {
                goto L_0017;
            }

        L_000A:
            {
            }
            theObject2 = false;
            goto L_00C0;

        L_0017:
            {
            }
            i = Math.Min(paramNames.Length, paramTypes.Length);
            i = Math.Min(i, paramValues.Length);
            if (i != 0)
            {
                goto L_003E;
            }
            theObject2 = false;
            goto L_00C0;

        L_003E:
            try
            {
                this.connection.Open();
                theSqlCommand = new SqlCommand(sql, this.connection);
                i2 = 0;
                goto L_008E;

            L_005A:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], paramTypes[i2]);

            L_0078:
                {
                }

            L_0074:
                {
                }
                theSqlParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_008E:
                {
                }
                if (i2 < i)
                {
                    goto L_005A;
                }
                theObject = theSqlCommand.ExecuteScalar();
                theSqlCommand.Dispose();
                this.connection.Close();
                theObject2 = theObject;
            }
            catch (Exception theException2)
            {

            L_00B1:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_00C0:
            {
            }
            return theObject2;
        }

        public int ExecuteSerialNonQueryWithParam(string sql, string[] paramNames, SqlDbType[] paramTypes, ArrayList paramValues)
        {
            int i;
            SqlConnection theSqlConnection;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            int i3;
            int i4;
            object[] theObjectArray;
            SqlParameter theSqlParameter2;
            Exception theException;
            int i5;
            IEnumerator theIEnumerator;
            IEnumerator theIEnumerator2;
            IDisposable theIDisposable;
            IDisposable theIDisposable2;
            if (paramNames == null)
            {
                goto L_000A;
            }
            if (paramTypes == null)
            {
                goto L_000A;
            }
            if (paramValues != null)
            {
                goto L_0015;
            }

        L_000A:
            {
            }
            throw new Exception("Database: Invalid parameter!");

        L_0015:
            {
            }
            i = Math.Min(paramNames.Length, paramTypes.Length);
            if (i == 0)
            {
                goto L_002D;
            }
            if (paramValues.Count != 0)
            {
                goto L_0038;
            }

        L_002D:
            {
            }
            throw new Exception("Database: Invalid parameter!");

        L_0038:
            try
            {
                theSqlConnection = this.connection;
                theSqlConnection.Open();
                theSqlCommand = new SqlCommand(sql, theSqlConnection);
                i2 = 0;
                goto L_0070;

            L_0051:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], paramTypes[i2]);
                SqlParameter theSqlParameter3 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_0070:
                {
                }
                if (i2 < i)
                {
                    goto L_0051;
                }
                i3 = 0;
                theIEnumerator = paramValues.GetEnumerator();

            L_0080:
                try
                {
                    goto L_00FD;

                L_0082:
                    {
                    }
                    theObjectArray = ((object[])theIEnumerator.Current);
                    i4 = 0;
                    theIEnumerator2 = theSqlCommand.Parameters.GetEnumerator();

                L_00A0:
                    try
                    {
                        goto L_00D0;

                    L_00A2:
                        {
                        }
                        theSqlParameter2 = ((SqlParameter)theIEnumerator2.Current);

                    L_00C5:
                        {
                        }

                    L_00C0:
                        {
                        }
                        theSqlParameter2.Value = ((theObjectArray[i4] != null) ? theObjectArray[i4] : DBNull.Value);
                        i4++;

                    L_00D0:
                        {
                        }
                        if (theIEnumerator2.MoveNext())
                        {
                            goto L_00A2;
                        }
                    }
                    finally
                    {

                    L_00DB:
                        {
                        }
                        theIDisposable = (theIEnumerator2 as IDisposable);
                        if (theIDisposable == null)
                        {
                            goto L_00EF;
                        }
                        theIDisposable.Dispose();

                    L_00EF:
                        {
                        }
                    }

                L_00F0:
                    {
                    }
                    int i6 = theSqlCommand.ExecuteNonQuery();
                    i3++;

                L_00FD:
                    {
                    }
                    if (theIEnumerator.MoveNext())
                    {
                        goto L_0082;
                    }
                }
                finally
                {

                L_010B:
                    {
                    }
                    theIDisposable2 = (theIEnumerator as IDisposable);
                    if (theIDisposable2 == null)
                    {
                        goto L_011F;
                    }
                    theIDisposable2.Dispose();

                L_011F:
                    {
                    }
                }

            L_0120:
                {
                }
                theSqlCommand.Dispose();
                theSqlConnection.Close();
                i5 = i3;
            }
            catch (Exception theException2)
            {

            L_0132:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_0141:
            {
            }
            return i5;
        }

        public int ExecuteSerialNonQueryWithParam(string sql, string[] paramNames, ArrayList paramValues)
        {
            SqlConnection theSqlConnection;
            SqlCommand theSqlCommand;
            int i;
            SqlParameter theSqlParameter;
            int i2;
            int i3;
            object[] theObjectArray;
            SqlParameter theSqlParameter2;
            Exception theException;
            int i4;
            IEnumerator theIEnumerator;
            IEnumerator theIEnumerator2;
            IDisposable theIDisposable;
            IDisposable theIDisposable2;
            if (paramNames == null)
            {
                goto L_0013;
            }
            if (paramValues == null)
            {
                goto L_0013;
            }
            if (paramNames.Length == 0)
            {
                goto L_0013;
            }
            if (paramValues.Count != 0)
            {
                goto L_001E;
            }

        L_0013:
            {
            }
            throw new Exception("Database: Invalid parameter!");

        L_001E:
            try
            {
                theSqlConnection = this.connection;
                theSqlConnection.Open();
                theSqlCommand = new SqlCommand(sql, theSqlConnection);
                i = 0;
                goto L_0057;

            L_0037:
                {
                }
                theSqlParameter = new SqlParameter();
                theSqlParameter.ParameterName = paramNames[i];
                SqlParameter theSqlParameter3 = theSqlCommand.Parameters.Add(theSqlParameter);
                i++;

            L_0057:
                {
                }
                if (i < paramNames.Length)
                {
                    goto L_0037;
                }
                i2 = 0;
                theIEnumerator = paramValues.GetEnumerator();

            L_0068:
                try
                {
                    goto L_00E5;

                L_006A:
                    {
                    }
                    theObjectArray = ((object[])theIEnumerator.Current);
                    i3 = 0;
                    theIEnumerator2 = theSqlCommand.Parameters.GetEnumerator();

                L_0088:
                    try
                    {
                        goto L_00B8;

                    L_008A:
                        {
                        }
                        theSqlParameter2 = ((SqlParameter)theIEnumerator2.Current);

                    L_00AD:
                        {
                        }

                    L_00A8:
                        {
                        }
                        theSqlParameter2.Value = ((theObjectArray[i3] != null) ? theObjectArray[i3] : DBNull.Value);
                        i3++;

                    L_00B8:
                        {
                        }
                        if (theIEnumerator2.MoveNext())
                        {
                            goto L_008A;
                        }
                    }
                    finally
                    {

                    L_00C3:
                        {
                        }
                        theIDisposable = (theIEnumerator2 as IDisposable);
                        if (theIDisposable == null)
                        {
                            goto L_00D7;
                        }
                        theIDisposable.Dispose();

                    L_00D7:
                        {
                        }
                    }

                L_00D8:
                    {
                    }
                    int i5 = theSqlCommand.ExecuteNonQuery();
                    i2++;

                L_00E5:
                    {
                    }
                    if (theIEnumerator.MoveNext())
                    {
                        goto L_006A;
                    }
                }
                finally
                {

                L_00F3:
                    {
                    }
                    theIDisposable2 = (theIEnumerator as IDisposable);
                    if (theIDisposable2 == null)
                    {
                        goto L_0107;
                    }
                    theIDisposable2.Dispose();

                L_0107:
                    {
                    }
                }

            L_0108:
                {
                }
                theSqlCommand.Dispose();
                theSqlConnection.Close();
                i4 = i2;
            }
            catch (Exception theException2)
            {

            L_011A:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_0129:
            {
            }
            return i4;
        }

        public void ExecuteStoredProc(string storeName, string[] paramNames, SqlDbType[] paramTypes, object[] paramValues)
        {
            int i;
            SqlCommand theSqlCommand;
            int i2;
            SqlParameter theSqlParameter;
            Exception theException;
            i = Math.Min(paramNames.Length, paramTypes.Length);
            i = Math.Min(i, paramValues.Length);

        L_0017:
            try
            {
                theSqlCommand = new SqlCommand(storeName, this.connection);
                theSqlCommand.CommandType = CommandType.StoredProcedure;
                i2 = 0;
                goto L_0063;

            L_002F:
                {
                }
                theSqlParameter = new SqlParameter(paramNames[i2], paramTypes[i2]);

            L_004D:
                {
                }

            L_0049:
                {
                }
                theSqlParameter.Value = ((paramValues[i2] != null) ? paramValues[i2] : DBNull.Value);
                SqlParameter theSqlParameter2 = theSqlCommand.Parameters.Add(theSqlParameter);
                i2++;

            L_0063:
                {
                }
                if (i2 < i)
                {
                    goto L_002F;
                }
                this.connection.Open();
                int i3 = theSqlCommand.ExecuteNonQuery();
                theSqlCommand.Dispose();
                this.connection.Close();
            }
            catch (Exception theException2)
            {

            L_008C:
                theException = theException2;
                throw new Exception(theException.Message);
            }

        L_009B:
            return;
        }


        #endregion
    }

}

